home *** CD-ROM | disk | FTP | other *** search
- /* JavaScript for Talk-n-Mail
- Copyright (c) 1999-2000, SoftApproach Corp. All rights reserved
- */
-
- var istSlideDivData // Data object
-
- /* Data object */
- function fstSlideMakeDivDataObject()
- {
- this.iInterval = 0
- this.bRandom = false
- this.iPageId = 0
- this.iPageTotal = 0
-
- this.iCurrentPage = 0
- this.iCountDown = 0
- this.bPause = false
-
- this.sCookieName = ""
-
- return this
- }
-
- /* Show the buttons according to the current choice */
- function fvSlideShowButtons()
- {
- var iTh, bIs, sButtons
- bIs = !istSlideDivData.bPause
- for(iTh = 1; iTh <= 2; iTh ++)
- {
- sButtons = "divButtons" + iTh
- fvShow(sButtons, bIs)
- bIs = !bIs
- }
- }
-
- // Wait for the next round
- function fvSlideTimer()
- {
- setTimeout("fvSlideGo()", 1000)
- }
-
- // Start / Main loop
- function fvSlideGo()
- {
- var iIndex = 0
- var isPage = ""
-
- // No Slidemation at all?
- if(istSlideDivData.iInterval = 0) return
-
- // Paused?
- if(istSlideDivData.bPause)
- {
- fvSlideTimer()
- return
- }
-
- // Countdown
- istSlideDivData.iCountDown --
- if(istSlideDivData.iCountDown > 0)
- {
- fvSlideTimer()
- return
- }
-
- // Random?
- if(istSlideDivData.bRandom)
- {
- do
- {
- iIndex = Math.round(Math.random() * istSlideDivData.iPageTotal)
- if(iIndex > istSlideDivData.iPageTotal)
- {
- iIndex = istSlideDivData.iPageTotal
- }
- else if(iIndex == 0)
- {
- iIndex = 1
- }
-
-
- }while(istSlideDivData.iCurrentPage == iIndex)
- }
- else
- {
- iIndex = istSlideDivData.iCurrentPage + 1
- if(iIndex > istSlideDivData.iPageTotal) iIndex = 1
- }
- // Keep
- istSlideDivData.iCurrentPage = iIndex
-
- // Page
- isPage = "$TNM$_"
- if(ibIsIE)
- {
- isPage += "ie"
- }
- else
- {
- isPage += "nc"
- }
-
- isPage += iIndex
- isPage += ".htm"
-
- window.location = isPage
-
- // Reset
- istSlideDivData.iCountDown = istSlideDivData.iInterval
-
- fvSlideTimer()
- }
-
- /* Store the user choice to the cookie */
- function fvSlideStoreToCookie()
- {
- var sValue
- var dtExpire = new Date()
- dtExpire.setTime(dtExpire.getTime() + 1000 * 60 * 60 * 24)
- sValue = istSlideDivData.bPause ? "1" : "0"
- fvSetCookie(istSlideDivData.sCookieName, sValue, dtExpire)
- }
-
- /* Retrieve the user choice from the cookie
- and display the buttons accordingly.
- */
- function fvSlideRetrieveFromCookie()
- {
- var sValue
-
- sValue = fsGetCookie(istSlideDivData.sCookieName)
- if(sValue == null) return
-
- istSlideDivData.bPause = sValue == "1" ? true : false
-
- if(istSlideDivData.bPause)
- {
- fvShow("divButtons1", false)
- fvShow("divButtons2", true)
- }
- }
-
- /* Toggle slide show on and off */
- function fvSlideToggleShow(bToPauseOnly)
- {
- if(bToPauseOnly && istSlideDivData.bPause) return
-
- istSlideDivData.bPause = !istSlideDivData.bPause
- fvSlideStoreToCookie()
-
- fvSlideShowButtons()
- }
-